package com.study.a06mySet;

import java.util.TreeSet;

public class A05_TreeSetDemo4 {
    public static void main(String[] args) {


        Student2 s1=new Student2("张三",18,90,15,80);
        Student2 s2=new Student2("李四",19,80,10,70);
        Student2 s3=new Student2("王五",20,70,80,60);
        Student2 s4=new Student2("赵六",21,60,90,50);
        Student2 s5=new Student2("王二",22,50,60,70);


        //o1:当前要添加的元素
        //o2:集合中已有的元素
        TreeSet<Student2> ts=new TreeSet<>();


        ts.add(s1);
        ts.add(s2);
        ts.add(s3);
        ts.add(s4);
        ts.add(s5);

        for (Student2 t : ts) {
            int sum=t.getChinese()+t.getMath()+t.getEnglish();
            System.out.println(sum);
            System.out.println(t);
        }







    }
}
